<template>
  <div>
    <el-form ref="form" :model="formData" label-width="100px" :rules="rules">
      <el-form-item label="流程分类" prop="processCategory">
        <el-select v-model="formData.processCategory" placeholder="流程分类">
          <el-option v-for="item in categorys" :key="item.value" :label="item.name" :value="item.id" />
        </el-select>
      </el-form-item>
      
      <el-form-item label="流程id" prop="id">
        <el-input v-model="formData.id" :disabled="!createFlag"/>
      </el-form-item>

      <el-form-item label="名称" prop="name">
        <el-input v-model="formData.name" />
      </el-form-item>

      <el-form-item label="描述" prop="documentation">
        <el-input v-model="formData.documentation" type="textarea" autosize/>
      </el-form-item>

      <!-- <el-form-item label="执行监听器" >
        <el-badge :value="executionListenerLength">
          <el-button @click="dialogName = 'executionListenerDialog'">编辑</el-button>
        </el-badge>
      </el-form-item> -->

      <!-- <el-form-item label="信号定义">
        <el-badge :value="signalLength">
          <el-button @click="dialogName = 'signalDialog'">编辑</el-button>
        </el-badge>
      </el-form-item> -->
        
    </el-form>

    <!-- <executionListenerDialog v-if="dialogName === 'executionListenerDialog'" :element="element" :modeler="modeler"
      @close="finishExecutionListener" /> -->

    <!-- <signalDialog v-if="dialogName === 'signalDialog'" :element="element" :modeler="modeler"
      @close="finishSignal" /> -->
  </div>
</template>

<script>
import mixinPanel from '../../common/mixinPanel'
// import mixinExecutionListener from '../../common/mixinExecutionListener'
// import signalDialog from './property/signal.vue'
import { commonParse } from '../../common/parseElement'
export default {
  components: {
    // signalDialog
  },
  mixins: [mixinPanel],
  props: {
    createFlag: {
      type: Boolean,
      required: false,
      default: true
    },
  },
  data() {
    return {
      dialogName: '',
      signalLength: 0,
      formData: {},
      rules: {
        id: [
          { required: true, message: 'Id 不能为空', trigger: 'blur' },
        ],
      },
    }
  },
  computed: {
  },
  watch: {
    'formData.processCategory': function (val) {
      if (val === '') val = null
      this.updateProperties({ 'flowable:processCategory': val })
    }
  },
  created() {
    this.formData = commonParse(this.element)
  },
  methods: {
    computedSignalLength() {
      console.log('computedSignalLength');
      this.signalLength = this.element.businessObject.extensionElements?.values?.length ?? 0
    },
    finishSignal() {
      if (this.dialogName === 'signalDialog') {
        this.computedSignalLength()
      }
      this.dialogName = ''
    }
  }
}
</script>

<style>

</style>
